import { queryDeviceAccess } from "@/apis/charts";
import { useRequest } from "ahooks";
import type { DeviceAccessResponseType } from "@/types/echartInterface";
const useGetDeviceAccessData = (times: string) => {
  const {
    data = {},
    loading,
  } = useRequest(
    async () => {
      const data = await queryDeviceAccess({ times });
      return data;
    },
    {
      refreshDeps: [times], //刷新依赖项
    }
  );
  const { deviceAccessList } = data as DeviceAccessResponseType;
  return { deviceAccessList, loading,  };
};

export default useGetDeviceAccessData;
